<?php 
function getLocalContent($dir){
	global $return_result;
	$apath = $_SERVER['DOCUMENT_ROOT'].$dir;
	if (is_dir($apath)) {		
            if ($dh = opendir($apath)) {
                while (($file = readdir($dh)) !== false) {
                    $uniqueID = rand();
                    $ftype = filetype($apath . $file);
                    if($file != "." && $file != ".."){
                        if($ftype == "dir"){
                            getLocalContent($dir . $file.'/');
                        }else if($ftype != "dir"){
                            $rpath = explode('/',$dir);
                            if(count($rpath)>2){
                                array_shift($rpath);
                                $dir = implode('/',$rpath);
                            }
                            $return_result[$dir][$file] = md5(file_get_contents($apath . $file));
                        }
                    }
                }
                closedir($dh);
            }
	}else{
            $rpath = explode('/',$dir);
            if(count($rpath)>2){
                array_shift($rpath);
                $dir = implode('/',$rpath);
            }
            $return_result[$dir] = md5(file_get_contents($apath));
        }
	return $return_result;
}
?>